import { TouchableOpacity } from "react-native";
import { AntDesign } from "@expo/vector-icons";

export default function Delete({board,setBoard,selectedCell, setWrongCells}){
    const handleDelete=()=>{
        const{row,col}=selectedCell;
        const newBoard=[...board];
        if(!newBoard[row][col].isFixed){
            newBoard[row][col].value=null;
            newBoard[row][col].noteValue=[];
            newBoard[row][col].isError = false;
        }
        setWrongCells([]);
        setBoard(newBoard);
    }
    return(
        <TouchableOpacity onPress={handleDelete} disabled={!selectedCell}>
            <AntDesign name="delete" size={25} color={selectedCell ? "black" : "gray"} />
        </TouchableOpacity>
    )
}